<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title><?php echo ($details['title']); ?>——我爱大重庆，有你更精彩</title>
    <meta name="keywords" content="重庆新闻,我爱大重庆,重庆,热点新闻,微信资讯" />
    <meta name="description" content="我爱大重庆资讯平台是我爱大重庆公众平台的附属产品，旨在为我爱大重庆的用户提供一个便捷的实时资讯浏览平台" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
    <style>
        body{
            background:#FFF;
        }
        .head{
            width:40px;
            height:40px;
            /*margin-top:0px;*/
            /*display: block;*/
            margin:0 auto;
            text-align: center;
        }
        .nickname{
            width:100%;
            display:block;
            margin:0 auto;
            text-align:center
        }
        embed{
            width:100% !important;
        }
        .content>p{
            padding-top:10px;
        }
        .content>p>img{
            width:100% !important;
        }
        blockquote {
            padding: 0px 5px;
            margin: 0 0 0px;
            font-size: 14px;
            border-left: 5px solid #eee;
            max-height: 60px;
            overflow: hidden;
        }
        .hidden-now{
            color: #FFF !important;
        }
        ul{
            list-style: none;
            padding-left:0;
            margin-left:0;
        }
        .content{
            margin:auto 3%;
            line-height: 1.8;
        }
        .pl{
            width:100%;
            border-radius: 5px;
            margin:0 auto;
            box-shadow: 0px 0px 10px #777;
            margin-bottom: 35px;
            border-top: 5px solid red;
        }
        h3{
            padding:0;
            margin:3px;
            margin-left:10px;
            margin-top: 10px;
        }
        h4{
            margin-left:10px;
        }
        li{
            border-top:1px solid #CCC;
            border-bottom:1px solid #CCC;
            float: left;
            width:100%;
            padding-top: 10px;
            padding-bottom: 10px;
        }
        .right{
            float: right;
        }
        .up,.down{
            margin:0 10px;
            font-size:18px;
        }
        .yes-left{
            float: left;
            width:40px;
            height:40px;
            line-height: 40px;
            background: #5BC0DE;
            color:#FFF;
            text-align:center;
            border-radius: 100%;
        }
        .yes-right{
            float: right;
            width:40px;
            height:40px;
            line-height: 40px;
            background: #D9534F;
            color:#FFF;
            text-align:center;
            border-radius: 100%;
            transform: rotate(180deg);
            -ms-transform: rotate(180deg);
            -webkit-transform: rotate(180deg);
        }
        .progress{
            height: 30px;
            margin-bottom: 0;
        }
        .progress-bar{
            line-height: 30px;
            height:30px;
        }
        .progress-bottom{
            margin:20px auto;
            font-size:26px;
        }
        .button-width{
            width:100%;
            text-align:left;
            padding-left:0;
            margin-bottom: 0;
        }
        .button-width>button{
            border-top-left-radius: 0;
            border-top-right-radius: 0 !important;
            border-right:0 !important;
            height:40px;
            border-left:0 !important;
            padding-top:10px;
            padding-bottom: 10px;
            position: relative;
            line-height:40px;
            /*margin:5px auto;*/
        }
        .button-width>button>div{
            margin-left:20px;
        }
        .btn-default{
            text-align:left;
        }
        .footer{
            position: fixed;
            z-index: 99999;
            bottom: 0;
            width:100%;
            height:40px;
            box-shadow: 0px 0px 20px #777;
            background:#FFF;
        }
        .footer>button{
            width:100%;
            height: 40px;
            border:0;
            margin:0px auto;
        }
        .margin-bottom{
            height:30px;
        }
        .header{
            position: fixed;
            z-index: 9;
            top: 0;
            width:100%;
            height:40px;
            box-shadow: 0px 0px 20px #777;
            background:#FFF;
        }
        .header>button{
            width:100%;
            height: 40px;
            border:0;
            margin:0px auto;
        }
        #cover{
            display:none;
            position:absolute;
            left:0;
            top:0;
            z-index:29;
            background-color:#000000;
            opacity:0.7;
        }
        #guide{
            display:none;
            position:absolute;
            right:18px;
            top:5px;
            z-index:29;
        }
        #guide img{
            width: 230px;
            z-index:91;
        }
        .button-width > .tp-now > .progress{
            /*margin:10px auto;*/
            border-radius: 0;
            position: relative;
        }
        .button-width > .tp-now > .progress > .progress-bar{
            text-align:left !important;
        }
        .tp-now{
            margin:10px auto;
        }
        .tp-now label{
            padding-top:10px;
        }
        .people{
            position: absolute;
            right: 5px;
            top: 5px;
        }
    </style>
</head>



<body data-spy="scroll" data-target="#navbar-example">

<div id="cover"></div>
<div id="guide"><img src="http://public.weirongm.com/YouXiMi//images/share.png"></div>

<div class="header">
    <button type="button" class="btn btn-default"  style="width:75%;text-align: center">
        <span class="glyphicon glyphicon-eye-open"></span> 浏览量:<?php echo ($details['see']); ?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <span class="glyphicon glyphicon-time"></span> 发表时间:<?php echo (timeFormat($details['createtime'])); ?>
    </button>
    <button type="button" class="btn btn-info" onClick="_system._guide(true)" style="border:0px;border-radius:0;float:right;text-align: center;width:20%;">分享</button>
</div>

<div class="margin-bottom" style="height: 45px"></div>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="row">
                <h3><?php echo ($details['title']); ?></h3>
                <div class="content">
                    <?php echo ($content['content']); ?>
                </div>

                <div class="col-xs-2 progress-bottom">
                    <span class="glyphicon glyphicon-thumbs-up right yes-left" aria-hidden="true"></span>
                </div>
                <div class="col-xs-8 progress-bottom" style="margin-top:26px;">
                    <div class="progress">
                        <div id="yes-left" data-click="0" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php if($details['up'] == 0){echo '50%';}else{echo floor(($details['up']/($details['up']+$details['down']))*10000)/10000*100;} ?>%">
                            赞(<span class="z"><?php echo ($details['up']); ?></span>)
                        </div>

                        <div id="yes-right"  data-click="0" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php if($details['down'] == 0){echo '50%';}else{echo floor(($details['down']/($details['up']+$details['down']))*10000)/10000*100;} ?>%">
                            踩(<span class="f" ><?php echo ($details['down']); ?></span>)
                        </div>
                    </div>
                </div>
                <div class="col-xs-2 progress-bottom">
                    <span class="glyphicon glyphicon-thumbs-up right yes-right" aria-hidden="true"></span>
                </div>
                <?php if(count($toupiao) > 0): ?><div class="col-xs-12">

                    <div class="row pl" style="border-top:5px solid cornflowerblue">
                        <h4 style="margin-bottom:0;border-bottom: 2px solid #FFF">投票<span style="font-size: 14px">(<?php echo ($count); ?>人参与)</span></h4>
                        <label style="margin-left: 10px;margin-top:5px;margin-bottom: 15px"><?php echo ($content['votename']); ?></label>
                        <div data-click="0" data-count="60000" class="btn-group-vertical button-width" id="abc" role="group" aria-label="Vertical button group">
                            <?php if(is_array($toupiao)): foreach($toupiao as $key=>$toupiao): ?><button data-id="<?php echo ($toupiao['id']); ?>" type="button" class="btn btn-default btn-click-tp">
                                    <div class="show-old" style="position: absolute;top: 0;left: 0;">
                                        <?php echo ($toupiao['vote']); ?>
                                    </div>
                                </button><?php endforeach; endif; ?>
                        </div>
                    </div>
                </div><?php endif; ?>
            </div>
            <!--<div class="row pl">-->
                <!--<h4 style="border-bottom: 2px solid #FFF">关注我们</h4>-->
                <!--<img src="http://public.weirongm.com/YouXiMi//images/woaidachongqing.gif" width="100%">-->
            <!--</div>-->
            <div class="row pl">
                <h4 style="border-bottom: 2px solid #FFF">最热评论</h4>
                <div>
                    <ul>
                        <?php if(is_array($bestc)): foreach($bestc as $key=>$bestc): ?><li>
                                <div class="col-xs-2">
                                    <img src="<?php echo ($bestc['userimg']); ?>" alt="" title="" class="img-circle head">
                                </div>
                                <div class="col-xs-10">
                                    <label style="margin-right:15px"><?php echo (strCut($bestc['nickname'],26)); ?></label>
                                    <span class="" style="float: right;color:#AAA">来自<?php echo ($bestc['province']); ?></span>
                                    <p><?php echo ($bestc['content']); ?></p>
                                    </div>
                                <div class="col-xs-12">
                                    <span class="" style="color:#AAA"><?php echo (timeFormat($bestc['createtime'])); ?></span>
                                    <span class="right math-right"><?php echo ($bestc['up']); ?></span><span data-type="up" data-id="<?php echo ($bestc['id']); ?>"  class="click-up glyphicon glyphicon-thumbs-up right up" style="<?php if(cookie($bestc['id']) == 1){ echo 'color:red';}else{echo 'color:#333';} ?>" aria-hidden="true"></span>
                                </div>
                            </li><?php endforeach; endif; ?>
                    </ul>
                </div>
            </div>
            <div class="row pl" style="border-top:5px solid orange">
                <h4 style="border-bottom: 2px solid #FFF">最新评论</h4>
                <div>
                    <ul class="click-ul">
                        <div class="tpl-put"></div>
                        <?php if(is_array($comment)): foreach($comment as $key=>$comment): ?><li>
                                <div class="col-xs-2">
                                    <img src="<?php echo ($comment['userimg']); ?>" alt="" title="" class="img-circle head">
                                </div>
                                <div class="col-xs-10">
                                    <label style="margin-right:15px"><?php echo (strCut($comment['nickname'],26)); ?></label>
                                    <span class="" style="float: right;color:#AAA">来自<?php echo ($comment['province']); ?></span>
                                    <p><?php echo ($comment['content']); ?></p>
                                </div>
                                <div class="col-xs-12">
                                    <span class="" style="color:#AAA"><?php echo (timeFormat($comment['createtime'])); ?></span>
                                    <span class="right math-right"><?php echo ($comment['up']); ?></span><span data-type="up" data-id="<?php echo ($comment['id']); ?>"  class="click-up glyphicon glyphicon-thumbs-up right up" style="<?php if(cookie($comment['id']) == 1){ echo 'color:red';}else{echo 'color:#333';} ?>" aria-hidden="true"></span>
                                </div>
                            </li><?php endforeach; endif; ?>
                        <div class="before"></div>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
<span class="limit" style="display: none">20</span>
<img src="http://public.weirongm.com/YouXiMi//images/news-loading.gif" class="loading" style="width:80px;height:80px;position: fixed;top:50%;left:50%;margin-left:-40px;margin-top:-40px;display: none ">

<div class="margin-bottom"></div>
<div class="footer">
    <button type="button" class="btn btn-danger" id="back" onclick="javascript:history.go(-1)" style="border:0;border-radius:0;width:20%;text-align: center;float: left"> <span class="glyphicon glyphicon-step-backward"></span></button>
    <button type="button" class="btn btn-default" id="shen" style="width:80%;text-align: center">我也有话说 <span class="glyphicon glyphicon-pencil"></span></button>
    <input type="text" id="content" name="content"  style="border:0;float:left;display:none;width:80%;font-size:14px;height:40px; line-height: 40px">
    <button type="button" class="btn btn-success fb" id="fb" style="display:none;border:0px;border-radius:0;float:left;text-align: center;width:20%;">发表</button>
</div>

<input type="hidden" name="id" value="<?php echo ($details['id']); ?>" id="id">
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
    $(function(){
        $('.button-width > button[type = button]').click(function(){
            var index = $(this).index();
            var vote_id = $(this).attr('data-id');
            var a = $(this);
            var id = $('#id').val();
            $.ajax({
                url:"<?php echo U('News/GetSuppor');?>",
                type:"post",
                dataType:'text',
                data:{id:id,vote_id:vote_id},
                success:function(data){
                    a.parent().find('button').remove();
                    $('#abc').html(data);
                }
            })
        })
        $('#fb').click(function(){
            var content = $('#content').val();
            if(content == '' || content == ''){
                alert('内容不能为空哦');
            }else{
                $.ajax({
                    url:"<?php echo U('News/comment');?>",
                    type:"post",
                    dataType:'text',
                    data:{content:content,tid:"<?php echo ($details['id']); ?>"},
                    success:function(data){
                        alert('发表成功！');
                        $('#content').val('');
                        $('#content').blur();
                        $(this).hide();
                        $('#back').show();
                        $('#shen').show();
                        $('.tpl-put').before(data);
                    }
                })
            }
        })
        $('#shen').click(function(){
            $(this).hide();
            $('#back').hide()
            $('#content').show() && $('#content').focus() && $('#fb').show();
        });
        $('.button-width > button').each(function(){
            $(this).click(function(){
                var isClick = $(this).parent().attr('data-click');
                if(isClick == 0){
                    $(this).parent().attr('data-click','1');
                }else{
                    alert('请不要重复表达观点哦');
                }

            })
        })
        $('.yes-left').click(function(){
            var id = "<?php echo ($details['id']); ?>";
            $.post("<?php echo U('News/up');?>",{id:id},function(data){
                if(data == 1){
                    alert('请不要重复点击哦');
                }else{
                    $('.z').html((parseInt($('.z').html())+1));
                    var count = parseInt($('.z').html())+parseInt($('.f').html());
                    $('#yes-left').css({
                        'width':(parseInt($('.z').html())/parseInt(count))*100+"%"
                    });
                    $('#yes-right').css({
                        'width':(parseInt(count)-(parseInt($('.z').html())))/parseInt(count)*100+"%"
                    });
                }
            });
        })
        $('.yes-right').click(function(){
            var id = "<?php echo ($details['id']); ?>";
            $.post("<?php echo U('News/down');?>",{id:id},function(data){
                if(data == 1){
                    alert('请不要重复点击哦');
                }else{
                    $('.f').html((parseInt($('.f').html())+1));
                    var count = parseInt($('.z').html())+parseInt($('.f').html());
                    $('#yes-right').css({
                        'width':(parseInt($('.f').html())/parseInt(count))*100+"%"
                    });
                    $('#yes-left').css({
                        'width':(parseInt(count)-(parseInt($('.f').html())))/parseInt(count)*100+"%"
                    });
                }
            });
        })
        $(document).on("click", ".click-up", function(){
            var k = $(this);
            var m = k.parent().find('.math-right');
            var mv = m.html();
            k.css('color','red');
            var comment_id = k.attr('data-id');
            var type = k.attr('data-type');
            $.post('<?php echo U("News/top");?>',{id:comment_id,type:type},function(data){
                if(data == 1){
                    alert('请不要重复点击哦');
                }else{
                    m.html(parseInt(mv)+parseInt(1))
                }
            })
        });
//        $('.click-up').click(function(){
//            var k = $(this);
//            var m = k.parent().find('.math-right');
//            var mv = m.html();
//            var comment_id = k.attr('data-id');
//            var type = k.attr('data-type');
//            $.post('<?php echo U("News/top");?>',{id:comment_id,type:type},function(data){
//                if(data == 1){
//                    alert('请不要重复点击哦');
//                }else{
//                    k.css('color','red');
//                 m.html(parseInt(mv)+parseInt(1))
//                }
//            })
//        })
        $('.click-down').click(function(){
            var k = $(this);
            var m = k.parent().find('.math-left');
            var mv = m.html();
            var comment_id = k.attr('data-id');
            var type = k.attr('data-type');
            $.post('<?php echo U("News/top");?>',{id:comment_id,type:type},function(data){
                if(data == 1){
                    alert('请不要重复点击哦');
                }else{
                    k.css('color','red');
                    m.html(parseInt(mv)+parseInt(1))
                }
            })
        })
//        $(window).scroll(function(){
//            $('#content').hide();
//            $('#shen').show();
//        });
    })
</script>
<script>
    var _system={
        $:function(id){return document.getElementById(id);},
        _client:function(){
            return {w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight,bw:document.documentElement.clientWidth,bh:document.documentElement.clientHeight};
        },
        _scroll:function(){
            return {x:document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft,y:document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop};
        },
        _cover:function(show){
            if(show){
                this.$("cover").style.display="block";
                this.$("cover").style.width=(this._client().bw>this._client().w?this._client().bw:this._client().w)+"px";
                this.$("cover").style.height=(this._client().bh>this._client().h?this._client().bh:this._client().h)+"px";
            }else{
                this.$("cover").style.display="none";
            }
        },
        _guide:function(click){
            this._cover(true);
            this.$("guide").style.display="block";
            this.$("guide").style.top=(_system._scroll().y+5)+"px";
            window.onresize=function(){_system._cover(true);_system.$("guide").style.top=(_system._scroll().y+5)+"px";};
            if(click){_system.$("cover").onclick=function(){
                _system._cover();
                _system.$("guide").style.display="none";
                _system.$("cover").onclick=null;
                window.onresize=null;
            };}
        },
        _zero:function(n){
            return n<0?0:n;
        }
    }
</script>
<script>
    //获取滚动条当前的位置
    function getScrollTop() {
        var scrollTop = 0;
        if (document.documentElement && document.documentElement.scrollTop) {
            scrollTop = document.documentElement.scrollTop;
        }
        else if (document.body) {
            scrollTop = document.body.scrollTop;
        }
        return scrollTop;
    }

    //获取当前可是范围的高度
    function getClientHeight() {
        var clientHeight = 0;
        if (document.body.clientHeight && document.documentElement.clientHeight) {
            clientHeight = Math.min(document.body.clientHeight, document.documentElement.clientHeight);
        }
        else {
            clientHeight = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
        }
        return clientHeight;
    }
    //获取文档完整的高度
    function getScrollHeight() {
        return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    }

</script>
<script>
    $(function(){
        window.onscroll = function () {
            if (getScrollTop() + getClientHeight() == getScrollHeight()) {
                var id = $('#id').val();
                var limit = $('.limit').html();
                $('.loading').show();
                $.post('<?php echo U("News/content");?>', {id:id,limit:limit}, function (data) {
//                    alert(data);
                    $('.before').before(data);
                    $('.loading').hide();
                    $('.limit').html(parseInt(limit)+parseInt(20))
                });
            }
        }
    })
</script>
</body>
</html>